<template>
  <div>
    <div>这是获取vuex 数据的第一种方式:{{ $store.state.jiafa.sum }}</div>
    <button @click="addData(3)" style="marginRight:10px">++</button>
    <button @click="asyncAdd(1)">一秒后加1</button> <br/>
    <!-- <h3>{{$store.getters.jiafa.show}}</h3> -->
   --------------------------------------------------------
    <HomeView></HomeView>
  </div>
</template>

<script>
import HomeView from "../views/HomeView.vue";
export default {
  components: {
    HomeView,
  },

  data() {
    return {};
  },
  computed:{
  },

  mounted() {
    console.log(this.$store);
  },
  methods: {
    addData(value){
         this.$store.commit('jiafa/add',value);
    },
    asyncAdd(value){
      this.$store.dispatch('jiafa/asynShow',value)
    },
  },
};
</script>

<style lang="less" scoped>
</style>
